package cn.wolfcode.service.impl;


import cn.wolfcode.mapper.ConsumptionReportMapper;
import cn.wolfcode.qo.ConsumptionReportQueryObject;
import cn.wolfcode.service.IConsumptionReportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class ConsumptionReportServiceImpl implements IConsumptionReportService {
    @Autowired
    private ConsumptionReportMapper consumptionReportMapper;

    @Override
    public PageInfo selectForList(ConsumptionReportQueryObject qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Map<String, Object>> maps = consumptionReportMapper.selectForList(qo);
        return new PageInfo(maps);
    }

    @Override
    public List<Map<String, Object>> selectForChart(String groupType) {
        List<Map<String, Object>> list = consumptionReportMapper.selectForChart(groupType);
        return list;
    }
}
